<template>
	<view>
		<view class="index">
			<view :class="'header ' + (banertrue ? 'header_lan' : '')" :style="'padding-top: ' + navH + 'px;'+ (kefulist.indextitle==20?'position:inherit;background:'+kefulist.indextitle_back :'')">
				<view class="header_height" :style="'height:' + gaodu + 'px;line-height:' + gaodu + 'px;top:' + gaodutops + 'px;'"></view>
				<view class="coloe_title" 
				:style="kefulist.indextitle==20?'color:'+ kefulist.indextitle_fontcolor :''">{{kefulist.name}}</view>
			</view>
			<view class="index_banner">
				<view class="pintuan_item1 xiche_img">
					<swiper
						:style="'height:' + kefulist.height_banner + 'px'"
						:indicator-dots="indicatorDots"
						:vertical="vertical"
						:autoplay="autoplay"
						:duration="duration"
						:interval="interval"
						:indicator-color="color"
						:indicator-active-color="colors"
						:circular="circular"
					>
						<swiper-item v-for="(item, index) in lunboarr" :key="index" v-if="lunboarr.length > 0">
							<image :src="item.image?item.image.file_path:''" class="slide-image" :data-type="item.redirect_type" :data-url="item.url" mode="widthFix" @tap="bannertiaozhuan" />
						</swiper-item>
					</swiper>
				</view>
			</view>

			<view class="index_center" style="margin-top: -60rpx">
				<view class="index_top">
					<!-- 导航菜单 -->
					<view class="index_item1" v-if="kefulist.is_navigation == 1">
						<view class="index_item1_list" v-if="navdata.length > 0">
							<view
								class="index_item1_cont"
								@tap="gotiaozhaun"
								:data-type="item.nav_linktype"
								:data-url="item.nav_link"
								v-for="(item, index) in navdata"
								:key="index"
							>
								<image :src="item.image?item.image.file_path:''"></image>
								<text style="font-weight: 600;">{{ item.name }}</text>
								<!-- <text>{{ $t('postlang.' + item.name) }}</text> -->
							</view>
						</view>
						<view class="index_item1_list" v-else>
							<view class="index_item1_cont" @tap="gotiaozhaun" :data-url="item.url" v-for="(item, index) in item1list" :key="index">
								<image :src="item.img"></image>
								<text>{{ item.name }}</text>
							</view>
						</view>
					</view>
					<!-- #ifdef MP-WEIXIN -->
					<view v-if="kefulist.is_wechatgzh == 1" class="item-official"><official-account></official-account></view>
					<!-- #endif -->
					<!-- 关注公众号 -->
					<view class="index_item6 borderstyle" v-if="officialaccount && officialaccount.is_index_open==1">
						<view class="index_item6_dis_off">
							<view class="index_item5_cont_top_l">
								<image :src="officialaccount.official_image" mode="aspectFill"></image>
								<view class="index_item5_cont_top_txt">
									<view class="index_item5_cont_top_t1">{{ officialaccount.name }}</view>
									<view class="index_item5_cont_top_t2">{{ officialaccount.description }}</view>
								</view>
							</view>
							<view class="index_item6_rr" @tap="tiaozhuanofficialaccount" :data-type="officialaccount.type" :data-url="officialaccount.link">
								<text>{{ $t('page_index.guanzhu') }}</text>
							</view>
						</view>
					</view>
					<!-- 新手区 -->
					<view v-if="kefulist.is_newhand == 1" class="index_item2" :style="kefulist.is_navigation == 0 ? 'margin-top:30px' : ''">
						<view class="index_item2_list" v-if="guide && guide.is_default==1">
							<view class="index_item2_cont" @tap="tiaozhuan" data-url="/pages/mys/my_xinshouxiadan/my_xinshouxiadan">
								<image :src="imgUrl + '/dzx_img10.png'"></image>
							</view>
							<view class="index_item2_cont" @tap="tiaozhuan" data-url="/pages/mys/my_jinyun/my_jinyun?type=0">
								<image :src="imgUrl + '/dzx_img11.png'"></image>
							</view>
							<view class="index_item2_cont"  @tap="tiaozhuan" data-url="/pages/mys/my_jinyun/my_jinyun?type=1">
								<image :src="imgUrl + '/dzx_img12.png'"></image>
							</view>
						</view>
						<view class="index_item2_list" v-if="guide && guide.is_default==0">
							<view class="index_item2_cont" :data-type="guide.first_url_type"  @tap="tiaozhuan" :data-url="guide.first_url">
								<image :src="guide.first_image"></image>
							</view>
							<view class="index_item2_cont" :data-type="guide.second_url_type"  @tap="tiaozhuan" :data-url="guide.second_url">
								<image :src="guide.second_image"></image>
							</view>
							<view class="index_item2_cont" :data-type="guide.third_url_type"  @tap="tiaozhuan" :data-url="guide.third_url">
								<image :src="guide.third_image"></image>
							</view>
						</view>
					</view>
					<!-- 广告图 -->
					<view
						class="index_item3"
						@tap="tiaozhuan"
						v-if="kefulist.is_yaoqing == 1 && adviseBanner.length > 0"
					>
					<swiper
						:indicator-dots="indicatorDots"
						:vertical="vertical"
						:autoplay="autoplay"
						:duration="duration"
						:interval="interval"
						:indicator-color="color"
						:indicator-active-color="colors"
						:circular="circular"
					>
						<swiper-item v-for="(item, index) in adviseBanner" :key="index">
							<image :src="item.image?item.image.file_path:''" class="slide-image" :data-type="item.redirect_type" :data-url="item.url" mode="widthFix" @tap="bannertiaozhuan" />
						</swiper-item>
					</swiper>
					</view>
				</view>

				<view class="index_item4" v-if="kefulist.is_line == 1">
					<view class="index_item4_title">
						<view class="index_item4_l">
							<image :src="imgUrl + '/dzx_img14.png'"></image>
							<text>{{ $t('page_index.bestRoute') }}</text>
						</view>
					</view>
					<swiper class="swiper paid_list_cont" @change="pagechange" :current="currentIndex" :style="'height:' + height + ';'">
						<block v-for="(item, index) in zuijiaxianlu" :key="index">
							<swiper-item>
								<view :class="'index_item4_list index_list_heji' + index">
									<view class="index_item4_cont" @tap="goluxian" :data-id="items.id" v-for="(items, index1) in item" :key="index1">
										<view class="index_item4_cont_l" v-if="items.image">
											<image :src="items.image?items.image.file_path:''" mode="aspectFill"></image>
										</view>
										<view class="index_item4_cont_r">
											<view class="index_item4_cont_r_t1">
												{{ items.name }}({{ $t('page_index.aging') }}：{{ items.limitationofdelivery }} {{ $t('page_index.day') }})
											</view>
											<view class="index_item4_cont_r_dis">
												<!--      <view class="index_item4_cont_r_t2">
                                                    时效：
                                                    <text>{{ items.limitationofdelivery }}天</text>
                                                </view> -->
												<view class="index_item4_cont_r_t2">
													{{ $t('page_index.tariff') }}：
													<text>{{ items.tariff }}</text>
												</view>
											</view>
											<view class="index_item4_cont_r_t2">{{ $t('page_index.lineCharacteristics') }}：{{ items.line_special }}</view>
										</view>
									</view>
								</view>
							</swiper-item>
						</block>
					</swiper>
					<view class="index_item4_heng">
						<view class="index_item4_banner" :style="'width:' + 38 * zuijiaxianlu.length + 'rpx;'"><view class="index_item4_lan" :style="'left:' + lefts"></view></view>
					</view>
				</view>
				<view class="index_item4" v-if="kefulist.is_pinglun == 1">
					<view class="index_item4_title">
						<view class="index_item4_l">
							<image :src="imgUrl + '/dzx_img16.png'"></image>
							<text>{{ $t('page_index.topComments') }}</text>
						</view>
						<view class="index_item4_r" @tap="gohotpinlun">
							<text>{{ $t('page_index.seeMore') }}</text>
							<image :src="imgUrl + '/dzx_img17.png'"></image>
						</view>
					</view>
					<swiper class="swiper paid_list_cont" @change="pagechange2" :current="currentIndex2" :style="'height:' + height + ';'">
						<block v-for="(item, index) in remenpl" :key="index">
							<swiper-item>
								<view :class="'index_item5_cont index_list_hejis' + index">
									<view class="index_item5_cont_top">
										<view class="index_item5_cont_top_l">
											<image :src="item.user ? item.user.avatarUrl : ''" mode="aspectFill"></image>
											<view class="index_item5_cont_top_txt">
												<view class="index_item5_cont_top_t1">{{ item.user ? item.user.nickName : $t('page_index.unknown') }}</view>
												<view class="index_item5_cont_top_t2">{{$t('page_hotpinlun.odrder')}}：{{ item.order_sn }}</view>
											</view>
										</view>
										<view class="index_item5_cont_top_r">
											<view class="index_item5_cont_top_t2">{{ item.create_time }}</view>
											<view class="index_item5_cont_top_img">
												<image :src="imgUrl + '/dzx_img21.png'" v-for="(items, index1) in star" v-if="index1 < item.score.all" :key="index1"></image>
											</view>
										</view>
									</view>
									<view class="index_item5_cont_bottom">
										<view class="index_item5_cont_bottom_txt">{{ item.content }}</view>
										<view class="index_item5_cont_bottom_img" :data-url="item" v-if="item.image != ''" @click="previewImage">
											<view
												class="index_item5_cont_bottom_imgs"
												v-for="(itemk, index1) in item.image"
												:key="index1"
												:data-url="itemk"
												:data-index="index1"
												@click="getIndex"
											>
												<image :src="itemk.file_path" mode="aspectFill"></image>
											</view>
										</view>
									</view>
								</view>
							</swiper-item>
						</block>
					</swiper>
					<view class="index_item4_heng">
						<view class="index_item4_banner" :style="'width: ' + remenpl.length * 38 + 'rpx;'"><view class="index_item4_lan" :style="'left:' + lefts2"></view></view>
					</view>
				</view>

				<view class="index_item6" v-if="kefulist.is_wechat == 1 || kefulist.is_phone == 1 || kefulist.is_wechathao==1">
					<view class="index_item4_title">
						<view class="index_item4_l">
							<image :src="imgUrl + '/dzx_img18.png'"></image>
							<text>{{ $t('page_index.customerServiceHotline') }}</text>
						</view>
					</view>
					<view class="index_item6_dis" v-if="kefulist.is_phone == 1">
						<view class="index_item5_cont_top_l">
							<image :src="imgUrl + '/dzx_img19.png'" mode="aspectFill"></image>
							<view class="index_item5_cont_top_txt">
								<view class="index_item5_cont_top_t1">{{ kefulist.service_name }}</view>
								<view class="index_item5_cont_top_t2">{{ $t('page_index.serviceHotline') }}：{{ kefulist.service_phone }}</view>
							</view>
						</view>
						<view class="index_item6_r" @tap="freeTell" :data-phone="kefulist.service_phone">
							<image :src="imgUrl + '/dzx_img20.png'"></image>
							<text>{{ $t('page_index.callHotline') }}</text>
						</view>
					</view>
					<!-- #ifdef MP-WEIXIN -->
					<view class="index_item6_dis" v-if="kefulist.is_wechat == 1">
						<view class="index_item5_cont_top_l">
							<image :src="imgUrl + '/dzx_img19.png'" mode="aspectFill"></image>
							<view class="index_item5_cont_top_txt">
								<view class="index_item5_cont_top_t1">{{ kefulist.wechat_name }}</view>
								<view class="index_item5_cont_top_t2">{{ $t('page_index.onlineService') }}</view>
							</view>
						</view>
						<view class="index_item6_r">
							<button
								style="
                  display: contents;
                  background: transparent;
                  line-height: 12px;
                "
								open-type="contact"
								bindcontact="handleContact"
							>
								<image open-type="contact" :src="imgUrl + '/kefu.png'"></image>
								<text>{{ $t('page_index.onlineService') }}</text>
							</button>
						</view>
					</view>
					<!-- #endif -->
					<view class="index_item6_dis" v-if="kefulist.is_wechathao == 1">
						<view class="index_item5_cont_top_l">
							<image :src="imgUrl + '/dzx_img19.png'" mode="aspectFill"></image>
							<view class="index_item5_cont_top_txt">
								<view class="index_item5_cont_top_t1">{{ kefulist.wechat_name }}</view>
								<view class="index_item5_cont_top_t2">{{ $t('page_index.wechatNumber') }}：{{ kefulist.wechathao }}</view>
							</view>
						</view>
						<view class="index_item6_r" @tap="fuzhi" :data-name="kefulist.wechathao">
							<button
								style="
                  display: contents;
                  background: transparent;
                  line-height: 12px;
                "
							>
								<image :src="imgUrl + '/copy.png'"></image>
								<text>{{ $t('page_index.capyWechat') }}</text>
							</button>
						</view>
					</view>
					<view class="index_item6_dis" v-if="kefulist.is_kefuemail == 1">
						<view class="index_item5_cont_top_l">
							<image :src="imgUrl + '/dzx_img19.png'" mode="aspectFill"></image>
							<view class="index_item5_cont_top_txt">
								<view class="index_item5_cont_top_t1">{{ kefulist.emailname }}</view>
								<view class="index_item5_cont_top_t2">{{ $t('page_index.mailboxNumber') }}：{{ kefulist.kefuemail }}</view>
							</view>
						</view>
						<view class="index_item6_r" @tap="fuzhi" :data-name="kefulist.kefuemail">
							<button
								style="
                  display: contents;
                  background: transparent;
                  line-height: 12px;
                "
							>
								<image :src="imgUrl + '/copy.png'"></image>
								<text>{{ $t('page_index.copyMailbox') }}</text>
							</button>
						</view>
					</view>
				</view>
			</view>
			<!-- changelang -->
			<!-- <view @click="changelang" class="languagechange">{{ $t('pageindex.语言切换') }}（Change Language）</view> -->
			<!-- #ifdef H5 -->
			<view class="languagechange" @click="tobeian">{{filing_number}}</view>
			<!-- #endif -->
		</view>
		<!-- 弹窗公告 -->
		<view :style="'display:' + display" class="baoguo_guize"  v-if="kefulist.jumpbox && (kefulist.jumpbox.mode == 10 || kefulist.jumpbox.mode == 20) && noticelength > 0">
			<view class="baoguo_guize_banner">
				<image
					:src="noticeBanner.image.file_path"
					mode="widthFix"
					style="max-height: 60vh; width: 100%"
					:data-type="noticeBanner.redirect_type"
					:data-src="noticeBanner.image.file_path"
					:key="index"
					@tap="tiaozhuan"
					:data-url="noticeBanner.url"
				></image>
				<view v-if="noticeBanner.title != ''" class="baoguo_guize_title" :data-type="noticeBanner.redirect_type" :key="index" @tap="tiaozhuan" :data-url="noticeBanner.url">
					{{ noticeBanner.title }}
				</view>
				<view class="baoguo_guize_btns" @tap="isguizeshows" :data-id="noticeBanner.id">
					<view class="baoguo_guize_btns_txt">{{ $t('page_index.ISee') }}</view>
				</view>
			</view>
		</view>
		<!-- 微信公众号 -->
		<view  :style="'display:' + gzhdisplay" class="baoguo_guize" v-if="wechatlength>0">
			<view class="baoguo_guize_banner">
				<image
					:src="wechatBanner.image.file_path"
					mode="widthFix"
					style="max-height: 60vh; width: 100%"
					:data-type="wechatBanner.redirect_type"
					:data-src="wechatBanner.image.file_path"
					:key="index"
					@tap="tiaozhuan"
					:data-url="wechatBanner.url"
				></image>
				<view v-if="wechatBanner.title != ''" class="baoguo_guize_title" :data-type="wechatBanner.redirect_type" :key="index" @tap="tiaozhuan" :data-url="noticeBanner.url">
					{{ wechatBanner.title }}
				</view>
				<view class="baoguo_guize_btns" @tap="isgzhshows" :data-id="wechatBanner.id">
					<view class="baoguo_guize_btns_txt">{{ $t('page_index.ISee') }}</view>
				</view>
			</view>
		</view>
		
		<tabbar :showmenu="menu_type" current="0"></tabbar>
	</view>
</template>

<script>
// index.js
// 获取应用实例
const app = getApp();

let request = require('../../utils/require');
import tabbar from '@/components/tabbar/tabbar.vue';
export default {
	components: {
		tabbar
	},
	data() {
		return {
			navH: 0,
			gaodu: app.globalData.height,
			gaodutops: app.globalData.top,
			imgUrl: app.globalData.imgUrl,
			top: 0,
			index: 0,
			indexId: 0,
			menu_type: uni.getStorageSync('menu_type'),
			imgindex: 0,
			filing_number:'',
			item: {
				indexId: 0,
				colors: '#fff;',
				isfujin: '',
				isshop: ''
			},
			banertrue: false,
			display: 'flex',
			gzhdisplay: 'flex',
			item1list: [
				{
					id: 0,
					name: '包裹预报',
					img: app.globalData.imgUrl + '/dzx_img2.png',
					url: '/pages/indexs/baoguoyg/baoguoyg'
				},
				{
					id: 1,
					name: '我的包裹',
					img: app.globalData.imgUrl + '/dzx_img3.png',
					url: '/pages/indexs/dairuku/dairuku'
				},
				{
					id: 2,
					name: '申请打包',
					img: app.globalData.imgUrl + '/dzx_img4.png',
					url: '/pages/indexs/shenqingdb/shenqingdb'
				},
				{
					id: 3,
					name: '待付款',
					img: app.globalData.imgUrl + '/dzx_img5.png',
					url: '/pages/indexs/my_dingdan/my_dingdan?id=2&type=nopay'
				},
				{
					id: 4,
					name: '包裹认领',
					img: app.globalData.imgUrl + '/dzx_img6.png',
					url: '/pages/indexs/shenqingdb_renling/shenqingdb_renling'
				},
				{
					id: 5,
					name: '仓库列表',
					img: app.globalData.imgUrl + '/dzx_img7.png',
					url: '/pages/indexs/cangkudizhi_list/cangkudizhi_list'
				},
				{
					id: 6,
					name: '运费估算',
					img: app.globalData.imgUrl + '/dzx_img8.png',
					url: '/pages/indexs/yunfeigusuan/yunfeigusuan'
				},
				{
					id: 7,
					name: '操作指引',
					img: app.globalData.imgUrl + '/dzx_img9.png',
					url: '/pages/mys/my_xinshouxiadan/my_xinshouxiadan'
				}
			],

			currentIndex: 0,
			lefts: 0,
			currentIndex2: 0,
			lefts2: 0,
			tankuangisshows: false,
			star: [1, 2, 3, 4, 5],
			//轮播图
			circular: true,

			//是否显示画板指示点
			indicatorDots: false,

			//选中点的颜色
			colors: '#5D59EC',

			//未选中点的颜色
			color: '#fff',

			//是否竖直
			vertical: false,

			//是否自动切换
			autoplay: true,

			//自动切换的间隔
			interval: 5000,

			//滑动动画时长毫秒
			duration: 1000,

			//默认
			current: 0,

			lunboarr: [],
			adviseBanner: [],
			noticeBanner: [],
			wechatBanner:[],
			noticelength: 0,
			wechatlength: 0,
			//轮播图数组
			urlimg: app.globalData.urlimg,
			imgUrl: app.globalData.imgUrl,
			yaoqingshow: 0,

			//是否显示邀请
			zuijiaxianlu: [],

			//最佳路线数组
			kefulist: {
				service_name: '',
				service_phone: '',
				is_wechat: 0,
				is_phone: 0
			},

			//客服信息
			number: [0, 0, 0, 0, 0],

			remenpl: {
				length: 0
			},

			height2: '',
			heights2: '',
			height: '200px',
			heights: '',
			userInfo: '',
			hasUserInfo: false,
			artimages: [],
			navdata: [],
			weburl: '',
			is_wxminiapp:0,
			guide:'',
			officialaccount:'',
			sms:[] //首页弹窗消息
		};
	}, //转发
	//用户点击右上角分享朋友圈
	onShareTimeline: function() {
		var that = this;
		return {
			title: that.kefulist.name,
			query: {
				key: '/pages/index/index'
			},
			imageUrl: that.kefulist.file_path
		};
	},
	//分享
	onShareAppMessage: function(options) {
		var that = this;
		var thisUserInfo = uni.getStorageSync('userInfo');
		var shareObj = {
			title: that.kefulist.title,
			desc: that.kefulist.desc,
			// 默认是小程序的名称(可以写果鸽集运等)
			path: '/pages/index/index?scene=uid%3A' + thisUserInfo.user_id,
			// thisUserInfo.user_id
			// scene: "uid%3A15027"
			// 默认是当前页面，必须是以‘/’开头的完整路径
			imageUrl: that.kefulist.file_path,
			//自定义图片路径，可以是本地文件路径、代码包文件路径或者网络图片路径，支持PNG及JPG，不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
			success: function(res) {
				// 转发成功之后的回调
				if (res.errMsg == 'shareAppMessage:ok') {
				}
			},
			fail: function() {
				// 转发失败之后的回调
				if (res.errMsg == 'shareAppMessage:fail cancel') {
					// 用户取消转发
				} else {
					if (res.errMsg == 'shareAppMessage:fail') {
					}
				}
			}
		};
		return shareObj;
	},
	//滑动显示顶部
	onPageScroll: function(e) {
		if (e.scrollTop > this.navH + 50) {
			this.banertrue= true
		} else {
			this.banertrue= false
		}
	},
	onLoad(options) {
		this.lunboimg();
	},
	onShow() {
		this.kefulistFun();
		uni.setNavigationBarTitle({
		      title: uni.getStorageSync("setting").name +' - ' +uni.getStorageSync("setting").title
		});
	},
	methods: {
		//复制
		fuzhi: function(e) {
			var that = this;
			uni.setClipboardData({
				data: e.currentTarget.dataset.name,
				success: function(res) {
					uni.getClipboardData({
						success: function(res) {
							uni.showToast({
								title: '复制成功'
							});
						}
					});
				}
			});
		},
		previewImage(e) {
			var len = e.currentTarget.dataset.url.image.length;
			var artimages = this.artimages;
			for (var i = 0; i < len; i++) {
				artimages[i] = e.currentTarget.dataset.url.image[i].file_path;
			}
			uni.previewImage({
				current: this.imgindex,
				urls: this.artimages
			});
		},
		changelang(){
			
			// this.globalData.checkLocalLanguage();
			// const appLanguage = uni.getSystemInfoSync().appLanguage;
			// 系统默认 zh-Hans（中文）
			// if (appLanguage === 'zh-Hans') {
				uni.showModal({
					content: '点击切换语言 \n go to the switch language',
					// confirmText:this.$t('components_mx_datepicker.sure'),
					confirmColor:'#27cc9d',
					success(res) {
						if (res.confirm) {
							uni.navigateTo({
								url: '/pages/switchLanguage/index'
							});
						}
					}
				});
			// }
		},
		getIndex(e) {
			this.imgindex= e.currentTarget.dataset.index
		},
		//拨打电话
		freeTell: function(e) {
			uni.makePhoneCall({
				phoneNumber: e.currentTarget.dataset.phone
			});
		},
		//复制
		fuzhi: function(e) {
			var that = this;
			uni.setClipboardData({
				data: e.currentTarget.dataset.name,
				success: function(res) {
					uni.getClipboardData({
						success: function(res) {
							uni.showToast({
								title: '复制成功'
							});
						}
					});
				}
			});
		},
		//轮播图、邀请
		lunboimg() {
			var that = this;
			var data = {
				token: uni.getStorageSync('token')
			};
			request.get(`index.php?s=/api/page/banner&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				if (res.data.code == 1) {
					that.lunboarr= res.data.data
				}
			});

			//广告图
			request.get(`index.php?s=/api/page/adviseBanner&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				console.log(res.data.data, 888);
				if (res.data.code == 1) {
					that.adviseBanner= res.data.data
				}
			});
			
			//微信公众号
			request.get(`index.php?s=/api/page/wechatBanner&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				console.log(res.data.data, 8886);
				if (res.data.code == 1) {
					that.wechatBanner= res.data.data[0]
					var user = uni.getStorageSync('userInfo')
					console.log(res.data.data.length,9877)
					if(user.gzh_openid ==''){
						that.wechatlength= res.data.data.length
					}else{
						that.wechatlength = 0;
					}
					
				}
			});
			
			//弹窗公告
			request.get(`index.php?s=/api/page/noticeBanner&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				console.log(res.data.data, 8886);
				if (res.data.code == 1) {
					that.noticeBanner= res.data.data[0]
					that.noticelength= res.data.length
				}
			});

			//邀请
			request.get(`index.php?s=/api/page/invite&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				if (res.data.code == 1) {
					that.yaoqingshow= res.data.data==null?res.data.data:res.data.data.values.is_open
					setTimeout(() => {
						that.swiperhegiht(that.currentIndex);
					}, 1000);
				}
			}); 
			
			//最佳线路
			request.get(`index.php?s=/api/page/goods_line&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				if (res.data.code == 1) {
					that.zuijiaxianlu= res.data.data
					setTimeout(() => {
						that.swiperhegiht2(that.currentIndex2);
					}, 1000);
				}
			}); 
			
			//热门评论
			request.post(`index.php?s=/api/comment/hotComment&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				console.log(res.data.data, 'resrmpl?');

				if (res.data.code == 1) {
					that.remenpl= res.data.data
				}
			});

			//获取导航动态信息
			request.post(`index.php?s=/api/nav/lists&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				if (res.data.code == 1) {
					that.navdata= res.data.data.list
				}
			});
			
			//消息通知
			if(uni.getStorageSync('token')){
				request.get(`index.php?s=/api/user/getsmslist&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
					console.log(res.data.data, 888);
					if (res.data.code == 1) {
						that.sms= res.data.data.data
						if(that.sms){
							uni.showModal({
								title: this.$t("page_index.sitemessage"),
								content: that.sms?that.sms.content:"",
								success: function (res) {
									if (res.confirm) {
										uni.navigateTo({
											url: '/pages/mys/my_sms/my_sms'
										});
									}
								}
							});
						}
					}
				});
			}
		},
		//跳转集运路线
		goluxian(e) {
			uni.navigateTo({
				url: '/pages/indexs/luxianxinxi/luxianxinxi?id=' + e.currentTarget.dataset.id
			});
		},
		//获取热门评论
		gohotpinlun(e) {
			uni.navigateTo({
				url: '/pages/indexs/hotpinlun/hotpinlun?type=0'
			});
		},
		//跳转备案链接
		tobeian(){
			window.location.href = 'https://beian.miit.gov.cn/';
		},
		tiaozhuan(e) {
			console.log(e, 8888999);
			var type = e.currentTarget.dataset.type;
			var urlweb = e.currentTarget.dataset.url;
			var image = e.currentTarget.dataset.src;
			if (type == 2) {
				uni.navigateTo({
					url: '/pages/webview/webview?' + 'url=' + urlweb
				});
			}
			if (type == 3) {
				uni.previewImage({
					urls:[image]
				})
				return;
			}
			uni.navigateTo({
				url: e.currentTarget.dataset.url
			});
		},
		tiaozhuanofficialaccount(e) {
			console.log(e, 8888999);
			var type = e.currentTarget.dataset.type;
			var urlweb = e.currentTarget.dataset.url;
			var image = this.officialaccount.official_pic;
			if (type == 20) {
				uni.navigateTo({
					url: '/pages/webview/webview?' + 'url=' + urlweb
				});
			}
			if (type == 10) {
				uni.previewImage({
					urls:[image]
				})
				return;
			}
			uni.navigateTo({
				url: e.currentTarget.dataset.url
			});
		},
		bannertiaozhuan(e) {
			console.log(e, 543);
			var type = e.currentTarget.dataset.type;
			var urlweb = e.currentTarget.dataset.url;
			if (type == 2) {
				uni.navigateTo({
					url: '/pages/webview/webview?' + 'url=' + urlweb
				});
			}
			uni.navigateTo({
				url: e.currentTarget.dataset.url
			});
		},

		gotiaozhaun(e) {
			var type = e.currentTarget.dataset.type;
			var urlweb = e.currentTarget.dataset.url;
			if (type == 2) {
				uni.navigateTo({
					url: '/pages/webview/webview?' + 'url=' + urlweb
				});
			}
			uni.navigateTo({
				url: e.currentTarget.dataset.url
			});
		},

		tankuangguanbi() {
			this.tankuangisshows= false
		},

		tankuang() {
			this.tankuangisshows= true
		},

		jump_indexs(e) {
			uni.reLaunch({
				url: '../index/index'
			});
		},

		jump_chaxun(e) {
			uni.navigateTo({
				url: '/pages/chaxun/chaxun'
			});
		},

		jump_pintuan(e) {
			uni.navigateTo({
				url: '/pages/indexs/yunfeigusuan/yunfeigusuan'
			});
		},
		isguizeshows(e) {
			var id = e.currentTarget.dataset.id;
			var that = this;
			var data = {
				id: id,
				token: uni.getStorageSync('token')
			};
			if (that.kefulist.jumpbox.mode == 10) {
				this.display= 'none'
			}
			request.post(`index.php?s=/api/page/bannerLog&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				if (res.data.code == 1) {
					this.display= 'none'
				}
			});
		},
		isgzhshows(e) {
			var id = e.currentTarget.dataset.id;
			var that = this;
			var data = {
				id: id,
				token: uni.getStorageSync('token')
			};
			if (that.kefulist.jumpbox.mode == 10) {
				this.gzhdisplay= 'none'
			}
			request.post(`index.php?s=/api/page/bannerLog&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				if (res.data.code == 1) {
					this.gzhdisplay= 'none'
				}
			});
		},

		jump_personal(e) {
			uni.reLaunch({
				url: '/pages/my/my'
			});
		},

		//swiper选项卡的高度
		swiperhegiht2(es) {
			var that = this;
			var query = uni.createSelectorQuery();
			query.selectAll('.index_list_hejis' + es).boundingClientRect();
			query.exec(res => {
				var listHeight = res?.[0]?.[0].height;
				that.height2= listHeight + 'px'
				that.heights2= res[0]
			});
		},

		//swiper切换时会调用
		pagechange2: function(e) {
			var that = this;
			console.log(e.detail.current, 'e.detail.current');
			that.currentIndex2= e.detail.current

			if (e.detail.current == 0) {
				that.lefts2= '0%'
			} else {
				if (e.detail.current == 1) {
					that.lefts2= '33%'
				} else {
					that.lefts2= '66%'
				}
			}

			that.swiperhegiht2(e.detail.current);
		},
		//swiper选项卡的高度
		swiperhegiht(es) {
			var that = this;
			var query = uni.createSelectorQuery();
			query.selectAll('.index_list_heji' + es).boundingClientRect();
			query.exec(res => {
				console.log('.index_list_heji' + es, 'res?');
				var listHeight = res?.[0]?.[0]?.height;
				if (listHeight) that.height = listHeight + 'px'
				that.heights= res?.[0]
			});
		},
		//设置
		kefulistFun() {
			var that = this;
			var data = {
				token: uni.getStorageSync('token')
			};
			request.post(`index.php?s=/api/page/service&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				if (res.data.code == 1) {
					that.guide = res.data.data.userclient==null?res.data.data.userclient:res.data.data.userclient.guide
					that.officialaccount = res.data.data.userclient==null?res.data.data.userclient:res.data.data.userclient.officialaccount
					that.kefulist= res.data.data.values
					that.menu_type=res.data.data.values.menu_type
					that.weburl = res.data.data.copyright.other_url
					that.is_wxminiapp = res.data.data.copyright.is_wxminiapp
					that.filing_number = res.data.data.copyright.filing_number
					uni.setStorageSync('setting', res.data.data.values);
					uni.setStorageSync('paytype', res.data.data.paytype);
					uni.setStorageSync('copyright', res.data.data.copyright);
					uni.setStorageSync('userclient', res.data.data.userclient);
					uni.setStorageSync('weight_mode', res.data.data.values.weight_mode);
					uni.setStorageSync('price_mode', res.data.data.values.price_mode);
					uni.setStorageSync('appname', res.data.data.values.name);
					uni.setStorageSync('is_categorysearch', res.data.data.values.is_categorysearch);
					uni.setStorageSync('address_setting', res.data.data.values.address_setting);
					uni.setStorageSync('menu_type', res.data.data.values.menu_type);
					console.log(that.kefulist.is_wechat, 'kefu');
				} else {
					uni.showToast({
						title: res.data.msg,
						icon: 'none'
					});
				}
			});
		},

		//swiper切换时会调用
		pagechange: function(e) {
			var that = this;
			console.log(e.detail.current, 'e.detail.current');
			that.currentIndex= e.detail.current
			var leftjuli = (100 / that.zuijiaxianlu.length) * e.detail.current;
			that.lefts= leftjuli + '%'
			that.swiperhegiht(e.detail.current);
		},

		// 事件处理函数
		bindViewTap() {
			uni.navigateTo({
				url: '../logs/logs'
			});
		},

		getUserProfile(e) {
			// 推荐使用wx.getUserProfile获取用户信息，开发者每次通过该接口获取用户个人信息均需用户确认，开发者妥善保管用户快速填写的头像昵称，避免重复弹窗
			uni.getUserProfile({
				desc: '展示用户信息',
				// 声明获取用户个人信息后的用途，后续会展示在弹窗中，请谨慎填写
				success: res => {
					console.log(res);
					this.userInfo= res.userInfo
					this.hasUserInfo= true
				}
			});
		},

		getUserInfo(e) {
			// 不推荐使用getUserInfo获取用户信息，预计自2021年4月13日起，getUserInfo将不再弹出弹窗，并直接返回匿名的用户个人信息
			console.log(e);
			this.userInfo= e.detail.userInfo
			this.hasUserInfo= true
		}
	}
};
</script>
<style lang="less">
@import './index.css';
.box1 {
		box-sizing: border-box;
		width: 690rpx;
		height: 344rpx;
		background: #ffffff;
		border-radius: 24rpx 24rpx 24rpx 24rpx;
		padding: 24rpx 0;

		.title {
			font-weight: 500;
			font-size: 36rpx;
			color: #151515;
			text-align: center;
		}

		.btns {
			border-top: 1rpx solid #e5e5e5;
			display: flex;
			align-items: center;
			justify-content: space-evenly;
			margin-top: 64rpx;
			box-sizing: border-box;
		}
	}
</style>
